def eliminateDuplicates(numbers): 
    result = []
    for x in numbers:
        if x not in result:
            result.append(x)
    return result

def main():
    list1 = [ eval(x) for x in input().split() ]
    list2 = eliminateDuplicates(list1)
    print(" ".join(map(str,list1)))
    print(" ".join(map(str,list2)))
    
if __name__ == "__main__":
    main()
